﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ViewDetails
   
</asp:Content>
<script runat="server">

    int noOfRooms = 0;
    int noOfFacilities = 0;
    string HOTELIMAGE = "";
    
    public void Page_Load()
    {
        noOfRooms = Int32.Parse(ViewData["numberOfRooms"].ToString());
        noOfFacilities = Int32.Parse(ViewData["numberOfFacilities"].ToString());

        
        GridView3.DataSource = ViewData["roomDetails"];
        GridView3.DataBind();
        GridView2.DataSource = ViewData["facilitiesDetails"];
        GridView2.DataBind();

        foreach (GridViewRow gvr in GridView3.Rows)
        {
            Cs2102BookingSystem.Models.UserModel user = (Cs2102BookingSystem.Models.UserModel)Session["User"];
            if (string.IsNullOrEmpty(user.Email))
            {
               ((HyperLink)gvr.Cells[3].Controls[0]).NavigateUrl = "~/Account/LogOn?type=";
                                           
            }
            else
            {
                ((HyperLink)gvr.Cells[3].Controls[0]).NavigateUrl = "~/Booking/HotelBooking?HotelName="
                                            + ViewData["hoteName"] + "&Country=" +
                                              ViewData["country"] + "&HotelBranch=" +
                                              ViewData["branchName"] + "&Room=" +
                                              gvr.Cells[1].Text.ToString();
            }                      

        }

        if (noOfFacilities != 0)
        {
            FacilitiesPanel.Visible = true;
        }
        else
        {
            FacilitiesPanel.Visible = false;
        }

        if (noOfRooms != 0)
        {
            RoomPanel.Visible = true;
        }
    
        else
        {
            RoomPanel.Visible = false;
            
        }
        
     
    }

   
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
       
    }
</script>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server">

    <h2><%: ViewData["Message"] %></h2>
    <fieldset>
        
     <% Html.RenderPartial("ViewPartialHotelDetail", ViewData["hotelDetail"]); %>
  
     <asp:panel id="RoomPanel" runat="server" visible="false">

     <asp:GridView ID="GridView3" runat="server"  Height="200px" Width="738px" AutoGenerateColumns="False" 
             BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
             CellPadding="3" style="margin-left: 139px" 
              >
         <Columns>
             <asp:ImageField DataImageUrlField="ROOMIMAGE">
             </asp:ImageField>
             <asp:BoundField DataField="ROOMTYPE" HeaderText="Room Type" />
             <asp:BoundField DataField="PRICE" HeaderText="Price" />
             <asp:HyperLinkField Text="Book Now" />
         </Columns>
         <FooterStyle BackColor="White" ForeColor="#000066" />
         <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
         <PagerStyle ForeColor="#000066" HorizontalAlign="Left" BackColor="White" />
         <RowStyle ForeColor="#000066" />
         <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
         <SortedAscendingCellStyle BackColor="#F1F1F1" />
         <SortedAscendingHeaderStyle BackColor="#007DBB" />
         <SortedDescendingCellStyle BackColor="#CAC9C9" />
         <SortedDescendingHeaderStyle BackColor="#00547E" />
         </asp:GridView>
         </h2>

      
         </asp:panel>
              </br>
              </br>
              </br>
              </br>
              </br>
       <asp:panel id="FacilitiesPanel" runat="server" visible="false">
     
       <asp:GridView ID="GridView2" runat="server" 
        Height="200px" Width="744px" CellPadding="3" BackColor="White" 
        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
               style="margin-left: 142px" AutoGenerateColumns="False" >
            <Columns>
                <asp:ImageField DataImageUrlField="FACILITYIMAGE">
                </asp:ImageField>
                <asp:BoundField DataField="Facilities" HeaderText="Facilities" />
                <asp:BoundField DataField="Description" HeaderText="Description" />
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle ForeColor="#000066" HorizontalAlign="Left" BackColor="White" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#007DBB" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#00547E" />
        </asp:GridView>
         </asp:panel>
         

    </fieldset>
  
    
    </form>


   
   




    </table>


   
   




</asp:Content>
